package com.xiaobai.shardingsphere.controller;

import com.xiaobai.shardingsphere.entity.DistrictVO;
import com.xiaobai.shardingsphere.mapper.DistrictMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/district")
public class DistrictController {

    @Autowired
    private DistrictMapper districtMapper;

    @RequestMapping("/insert")
    public void insert(DistrictVO districtVO) {
        districtVO.setDistrictName("区域1");
        districtVO.setLevel("1");
        districtMapper.insertDist(districtVO);
    }

    @RequestMapping("/deleteDict")
    public int deleteDict(Long id) {
        return districtMapper.deleteDict(id);
    }

    @RequestMapping("/list")
    public List<Map<String, Object>> list() {
        return districtMapper.list();
    }
}
